#include <stdio.h>
#include <math.h>
#include <time.h>

int main()
{
	int fact,sum,n;
	

	scanf("%d",&n);
	sum=0;
	for(int i=1;i<=n;i++)
	{
		fact=1;
		for(int j=1;j<=i;j++)
		{
			fact=fact*j;
		}
		sum+=fact;
		printf("%d\n", sum);
	}
	printf("%d\n",sum%1000000);
	printf("time used :%f\n",(double)clock()/CLOCKS_PER_SEC);

	return 0;
}

